package navon.id.programs;

import java.util.Random;

public class Waterterrain {
	static Random random = new Random();
	Mapgenerator mapvar;
	int xvalue;
	int yvalue;

	public Waterterrain(Mapgenerator mg) {
		this.mapvar = mg;
		xvalue = random.nextInt(19);
		yvalue = random.nextInt(19);
		mapvar.map[xvalue][yvalue] = Mapterrain.WATER;
	}

	public void lakemaker() {
		if (xvalue == 0 && yvalue == 0) {
			mapvar.map[xvalue + 1][yvalue] = Mapterrain.WATER;
			mapvar.map[xvalue][yvalue + 1] = Mapterrain.WATER;
		} else if (xvalue == 19 && yvalue == 0) {
			mapvar.map[xvalue - 1][yvalue] = Mapterrain.WATER;
			mapvar.map[xvalue][yvalue - 1] = Mapterrain.WATER;
		} else if (xvalue == 0 && yvalue == 19) {
			mapvar.map[xvalue + 1][yvalue] = Mapterrain.WATER;
			mapvar.map[xvalue][yvalue - 1] = Mapterrain.WATER;
		} else if (xvalue == 19 && yvalue == 19) {
			mapvar.map[xvalue - 1][yvalue] = Mapterrain.WATER;
			mapvar.map[xvalue][yvalue - 1] = Mapterrain.WATER;
		} else if (xvalue != 0 && xvalue != 19) {
			if (yvalue != 0 && yvalue != 19) {
				mapvar.map[xvalue + 1][yvalue] = Mapterrain.WATER;
				mapvar.map[xvalue - 1][yvalue] = Mapterrain.WATER;
				mapvar.map[xvalue][yvalue - 1] = Mapterrain.WATER;
				mapvar.map[xvalue][yvalue + 1] = Mapterrain.WATER;
			} else if (yvalue != 0) {
				mapvar.map[xvalue + 1][yvalue] = Mapterrain.WATER;
				mapvar.map[xvalue - 1][yvalue] = Mapterrain.WATER;
				mapvar.map[xvalue][yvalue - 1] = Mapterrain.WATER;
			} else if (yvalue != 19) {
				mapvar.map[xvalue + 1][yvalue] = Mapterrain.WATER;
				mapvar.map[xvalue - 1][yvalue] = Mapterrain.WATER;
				mapvar.map[xvalue][yvalue + 1] = Mapterrain.WATER;
			}

		}

		else if (xvalue != 0) {
			mapvar.map[xvalue - 1][yvalue] = Mapterrain.WATER;
			mapvar.map[xvalue][yvalue + 1] = Mapterrain.WATER;
			mapvar.map[xvalue][yvalue - 1] = Mapterrain.WATER;
		} else if (xvalue != 19) {
			mapvar.map[xvalue + 1][yvalue] = Mapterrain.WATER;
			mapvar.map[xvalue][yvalue + 1] = Mapterrain.WATER;
			mapvar.map[xvalue][yvalue - 1] = Mapterrain.WATER;
		}

	}
}
